package edu.whu.demo.crawler.task;

import edu.whu.demo.crawler.httpUtil.HttpUtils;
import edu.whu.demo.dao.ActivityDao;
import edu.whu.demo.domain.Activity;
import edu.whu.demo.service.impl.ActivityServiceImpl;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.beans.factory.annotation.Autowired;

public class DoTask52JinSai {
    @Autowired
    HttpUtils httpUtils;

    @Autowired
    ActivityServiceImpl abstractActivityService;

    public void activityCrawler(){
        String url = "http://www.52jingsai.com/article-18088-1.html";
        String html = httpUtils.doGetHtml(url);
        parsePho(html);


    }

    public void parsePho(String html){
        Document doc = Jsoup.parse(html);
        Elements elements = doc.select("#article_content [data-id=117782]");
        for (Element element : elements) {
            Elements elements1 = element.select("p");
            Activity activity = new Activity();
            System.out.println(elements1.get(0).text());
        }
    }
}
